/**
 * @(#) RankingList.java
 */

package TheRestaurantOwner;

public class RankingList
{
	private java.util.List<String> names;
	private java.util.List<Integer> scores;
	
	public RankingList( )
	{
		names = new java.util.ArrayList<String>();
		scores = new java.util.ArrayList<Integer>();
	}
	
	public void addToRankingList( String name, int score )
	{
		int i;
		for (i = 0; i < names.size(); i++){
			if (scores.get(i) < score){
				break;
			}
		}
		names.add(i, name);
		scores.add(i, score);
		
		int limitSize = 10;
		if (names.size() > limitSize){
			names.remove(limitSize);
			scores.remove(limitSize);
		}
	}
	
	public void print( )
	{
		System.out.println("Ranking list:");
		for (int i = 0; i < names.size(); i++){
			System.out.print(names.get(i) + " : ");
			System.out.println(scores.get(i));
		}
	}
}
